﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.utils {
    import flash.display.*;
    import flash.media.*;
    import flash.system.ApplicationDomain;
    import flash.utils.*;

    public class AssetsLibrary {
		
        public static function getAsset(_arg1:String, _arg2:Class){
            var assetinstance:*;
            var assetclass:Class;
            var name_ = _arg1;
            var class_ = _arg2;
            try {
				var domain:ApplicationDomain = ApplicationDomain.currentDomain;
                assetclass = (getDefinitionByName(name_) as Class);
				//assetclass = ApplicationDomain.currentDomain.getDefinition(name_) as Class;
                if (assetclass){
                    assetinstance = new (assetclass);
                };
            } catch(e_:Error) {
				throw Error(e_.toString());
            };
            return (assetinstance);
        }
        public static function getMovieClip(_arg1:String, _arg2:String=null):MovieClip{
            var _local3:MovieClip = (getAsset(_arg1, MovieClip) as MovieClip);
            if (!_local3){
                _local3 = (getAsset(_arg2, MovieClip) as MovieClip);
            };
            if (_local3 == null){
            };
            return (_local3);
        }
        public static function getSound(_arg1:String):Sound{
            return ((getAsset(_arg1, Sound) as Sound));
        }
        public static function getBitmap(_arg1:String):Bitmap{
            var _local2:Class = (getDefinitionByName(_arg1) as Class);
            var _local3:BitmapData = new _local2(0, 0);
            return (new Bitmap(_local3.clone()));
        }

    }
}//package net.wooga.pets.utils 
